package com.yxb.profile.service.impl;

import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.yxb.profile.mapper.TeacherProfileMapper;
import com.yxb.profile.domain.TeacherProfile;
import com.yxb.profile.service.ITeacherProfileService;
import com.yxb.category.mapper.CategoryMapper;
/**
 * 教员信息Service业务层处理
 * 
 * @author 林德炫
 * @date 2025-03-28
 */
@Service
public class TeacherProfileServiceImpl implements ITeacherProfileService 
{
    @Autowired
    private TeacherProfileMapper teacherProfileMapper;
    @Autowired
    private CategoryMapper categoryMapper;

    /**
     * 查询教员信息
     * 
     * @param teacherId 教员信息主键
     * @return 教员信息
     */
    @Override
    public TeacherProfile selectTeacherProfileByTeacherId(Long teacherId)
    {
        return teacherProfileMapper.selectTeacherProfileByTeacherId(teacherId);
    }

    /**
     * 查询教员信息列表
     * 
     * @param teacherProfile 教员信息
     * @return 教员信息
     */
    @Override
    public List<TeacherProfile> selectTeacherProfileList(TeacherProfile teacherProfile)
    {
        return teacherProfileMapper.selectTeacherProfileList(teacherProfile);
    }

    /**
     * 新增教员信息
     * 
     * @param teacherProfile 教员信息
     * @return 结果
     */
    @Override
    public int insertTeacherProfile(TeacherProfile teacherProfile)
    {
        return teacherProfileMapper.insertTeacherProfile(teacherProfile);
    }

    /**
     * 修改教员信息
     * 
     * @param teacherProfile 教员信息
     * @return 结果
     */
    @Override
    public int updateTeacherProfile(TeacherProfile teacherProfile)
    {
        return teacherProfileMapper.updateTeacherProfile(teacherProfile);
    }

    /**
     * 批量删除教员信息
     * 
     * @param teacherIds 需要删除的教员信息主键
     * @return 结果
     */
    @Override
    public int deleteTeacherProfileByTeacherIds(Long[] teacherIds)
    {
        return teacherProfileMapper.deleteTeacherProfileByTeacherIds(teacherIds);
    }

    /**
     * 删除教员信息信息
     * 
     * @param teacherId 教员信息主键
     * @return 结果
     */
    @Override
    public int deleteTeacherProfileByTeacherId(Long teacherId)
    {
        return teacherProfileMapper.deleteTeacherProfileByTeacherId(teacherId);
    }

    //获取教员联系方式
    @Override
    public String getTeacherPhone(Long userId) {
        return teacherProfileMapper.getTeacherPhone(userId);
    }

    @Override
    public List<TeacherProfile> getTeacherList() {
        return teacherProfileMapper.getTeacherList();
    }

    @Override
    public List<TeacherProfile> getTeacherListByCategoryId(Long categoryId) {
        // 根据categoryId查询categoryName
        String categoryName = categoryMapper.getCategoryNameByCategoryId(categoryId);
        return teacherProfileMapper.getTeacherListByCategoryName(categoryName);
    }

    @Override
    public TeacherProfile getTeacherDetailByTeacherId(String teacherId) {
        return teacherProfileMapper.getTeacherDetailByTeacherId(teacherId);
    }
}
